<?php

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \common\models\LoginForm */

use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use frontend\models\FenhuiForm;
use common\models\articles\Articles;
use yii\captcha\Captcha;
use yii\helpers\Url;

$this->title = '申请入会';
$this->params['breadcrumbs'][] = $this->title;
$ar = Articles::find()->where(['category_id'=>37])->one();
?>
<div class="w1113" style="background:#fff;">
     <div id="V_left">

        <div class="Tou">
            <span><img src="../../images/Tou.jpg"></span><font>您好，<?=$member['username'];?></font>
            <div style="clear:both"></div>
        </div>


        <ul id="Accordion" class="Accordion">
            <li class="lia">
                <div class="link"><i class="fa fa-paint-brush"><img src="../../images/V_01.png"></i>修改会员资料</div>

            </li>
            <li class="lia">
                <div class="link"><i class="fa fa-code"><img src="../../images/V_02.png"></i>会员升级</div>
                <ul class="submenu">
                    <li><a href="#">申请成为理事</a></li>
                    <li><a href="#">申请成为常务理事</a></li>
                    <li><a href="#">申请成为副会长</a></li>
                </ul>
            </li>
            <li class="lia open">
                <div class="link"><i class="fa fa-mobile"><img src="../../images/V_03.png"></i>加入分会</div>
                <ul class="submenu" style="display: block;">
                 <?php foreach($fenhuis as $fh){ ?>
                    <li><a <?php if ($id == $fh['id']){ ?> style="color:#c40400 " <?php } ?> href="<?=yii\helpers\Url::to(['member/applyone','id'=>$fh['id']]);?>"><?=$fh['name'];?></a></li>
                 <?php } ?>
                </ul>
            </li>
            <li class="lia"><div class="link"><i class="fa fa-globe"><img src="../../images/V_04.png"></i>会议展览报名</div>
                <ul class="submenu">
                    <li><a href="#">会议</a></li>
                    <li><a href="#">防水展</a></li>
                </ul>
            </li>
            <li class="lia">
                <div class="link"><i class="fa fa-paint-brush"><img src="../../images/V_05.png"></i>认证、奖项申请</div>

            </li>
            <li class="lia">
                <div class="link"><i class="fa fa-paint-brush"><img src="../../images/V_06.png"></i>月度统计</div>

            </li>
            <li class="lia">
                <div class="link"><i class="fa fa-paint-brush"><img src="../../images/V_07.png"></i>出国考察</div>

            </li>
            <li class="lia">
                <div class="link"><i class="fa fa-paint-brush"><img src="../../images/V_08.png"></i>会员缴费</div>

            </li>
            <li class="lia"><div class="link"><i class="fa fa-globe"><img src="../../images/V_09.png"></i>发票管理</div>
                <ul class="submenu">
                    <li><a href="#">发票索取</a></li>
                    <li><a href="#">发票列表</a></li>
                    <li><a href="#">发票信息管理</a></li>
                    <li><a href="#">发票寄送地址管理</a></li>

                </ul>
            </li>
            <li class="lia">
                <div class="link"><i class="fa fa-paint-brush"><img src="../../images/V_10.png"></i>修改密码</div>

            </li>
        </ul>

     </div>
     <div id="V_right">
          <div class="A_title">
               <h3>注意事项：</h3>
               <ul>
                  <li>1、请在网上填写“会员登记表”并打印一份，首页盖公章，法人签字加盖公章；入会还需提供以下资料：公司营业执照复印件加盖公章；
税务登记证复印件加盖公章。</li>
                  <li>2、会费：实行年费制（自然年）第一年2500元，我们会开具：“全国性社会团体会费统一收据”。</li>
                  <li>3、如果公司法人或公司地址等信息有变动，请在网站上修改提交联合会审核。</li>
               </ul>
          </div>
          
          <div class="V_input">
               <h3 class="V_tle">申请加入<?=$grade['name'];?>：</h3>
               <img class="V_tpic" src="../../images/Vip1.png">
               <p class="V_pp"><span style="color:#c40400;">设置基本信息</span><span class="b">营业执照信息</span><span>详细信息</span></p>
              <label style="color: red">
                  <?php
                  if(\Yii::$app->getSession()->getFlash("success")) {
                      echo \Yii::$app->getSession()->getFlash("success");
                  }
                  ?>
              </label>

              <form class="registerform" action="<?= yii\helpers\Url::to(['member/applyone','id'=>$id]);?>" enctype="multipart/form-data" id="subform" method='post'>
                  <input name="_csrf" type="hidden" id="_csrf" value="<?= Yii::$app->request->csrfToken ?>">
               <p class="V_app"><label><font>*</font>企业名称：</label><input name="qiyemingcheng" value="<?=$info['qiyemingcheng'];?>" type="text"></p>
               <p class="V_app"><label><font>*</font>姓名：</label><input name="farendaibiao" value="<?=$info['farendaibiao'];?>" type="text"></p>
               <p class="V_app"><label><font>*</font>座机：</label><input name="farentel" value="<?=$info['farentel'];?>"  type="text"></p>
               <p class="V_app"><label><font>*</font>手机：</label><input name="farenmobile" style="width:270px; margin-right:10px;" type="text"><input id="btnSendCode" type="button" value="获取手机验证码" onClick="sendMessage()"  /></p>
               <p class="V_app">
                   <label>验证码：</label>
                   <input style="width:270px; "name="code" placeholder="验证码" id="yan" class="a" type="text">
                   <?= Captcha::widget(['name'=>'code','captchaAction'=>'member/captcha','imageOptions'=>['id'=>'login_code', 'title'=>'换一个', 'alt'=>'换一个'],'template'=>'{image}']);?>
               </p>
               <p class="V_app"><label>传真：</label><input name="farenfax"  value="<?=$info['farenfax'];?>"  type="text"></p>
               <p class="V_app"><label>职务：</label><input name="zhiwu" value="<?=$info['zhiwu'];?>"  type="text"></p>
               <div class="V_app">
                  <label style="float:left;"><font>*</font> 企业性质：</label>
                  
						<select tabindex="6" name="qiyexingzhi" class="dropdown" data-settings='{"cutOff": 12}'>
							<option value="" class="label">--- 请选择您的公司性质 ---</option>
							<option value="国有" <?php if ($info['qiyexingzhi'] =="国有" ){?> selected <?php }?> >国有</option>
							<option value="私营" <?php if ($info['qiyexingzhi'] =="私营" ){?> selected <?php }?>>私营</option>
							<option value="联营" <?php if ($info['qiyexingzhi'] =="联营" ){?> selected <?php }?> >联营</option>
							<option value="中外合资" <?php if ($info['qiyexingzhi'] =="中外合资" ){?> selected <?php }?> >中外合资</option>
							<option value="外资" <?php if ($info['qiyexingzhi'] =="外资" ){?> selected <?php }?> >外资</option>
						</select>
                    <div style="clear:both"></div>                   
               </div>
               <p class="V_app"><label>企业官网：</label><input value="<?=$info['qiyewangzhi'];?>"  name="qiyewangzhi" type="text"></p>
               

                
			   <p class="V_app"><label><font>*</font>地址：</label><select value="<?= $info['province'] ?>" class="SSelect" id="province" name="province" tabindex="3">

              </select>
              <select class="SSelect" value="<?= $info['city'] ?>" id="city" name="city" tabindex="4">

              </select>
              <select class="SSelect" value="<?= $info['towm'] ?>" id="area" name="towm" tabindex="5">

              </select></p>
               <p class="V_app"><label><font>*</font>企业通讯地址：</label><input value="<?=$info['qiyedizhi'];?>"  name="qiyedizhi" type="text"></p>
               <p class="V_app"><label><font>*</font>邮政编码：</label><input value="<?=$info['youbian'];?>"  name="youbian" type="text"></p>
               <p class="V_app"><label><font>*</font>注册资金：</label><input value="<?=$info['zhucezijin'];?>"  name="zhucezijin" type="text"></p>
               <p class="V_app"><label><font>*</font>联络用邮箱：</label><input value="<?=$info['email'];?>"  name="email" type="text"></p>


               <div class="V_app">
                      <label style="vertical-align:top; float:left;">商标图：</label>
                      <div class="updiv" style="margin:0">
                          
                          <div class="con4">
                                <canvas class="all_cva" id="cvs" width="150" height="150"></canvas>
                                <span class="btn upload">选择文件<input type="file" name="shangbiaotu" class="upload_pic" id="upload" /></span>
                          </div>
                      </div>
                   <?php
                   if(!empty($shangbiaotu['newname']))
                   {?>
                       <img class="s_img" name="shangbiaotu"  src="/upload/<?= $shangbiaotu['newname'] ?>"  />
                   <?php } ?>
                   <div style="clear:both"></div>
               		  
               </div>
               <p class="V_app"><label>代理商标文字：</label><input  value="<?=$info['sbwenzi'];?>" name="sbwenzi" type="text"></p>
               <p class="V_app"><label style="vertical-align:top;"><font>*</font>公司简介：</label><textarea name="qiyejianjie" ><?=$info['qiyejianjie'];?></textarea></p>
                <input type="hidden" name="status" value="<?=$info['status'];?>">

                <div class="V_app">
                     <div class="updiv">
                          <input type="submit" value="保存，下一步" class="up_sub" />
                      </div>
                </div>
             </form>
          </div>
          
     </div>
     <div style="clear:both"></div>
</div>


<script type="text/javascript">
var InterValObj; //timer变量，控制时间
var count = 30; //间隔函数，1秒执行
var curCount;//当前剩余秒数
var code = ""; //验证码
var codeLength = 6;//验证码长度
function sendMessage() {
curCount = count;
var dealType; //验证方式
var uid=$("#uid").val();//用户uid
if ($("#phone").attr("checked") == true) {
	dealType = "phone";
}
else {
	dealType = "email";
}
//产生验证码
for (var i = 0; i < codeLength; i++) {
	code += parseInt(Math.random() * 9).toString();
}
//设置button效果，开始计时
	$("#btnSendCode").attr("disabled", "true");
	$("#btnSendCode").val( + curCount + "秒再获取");
	InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器，1秒执行一次
//向后台发送处理数据
	$.ajax({
		type: "POST", //用POST方式传输
		dataType: "text", //数据格式:JSON
		url: 'Login.ashx', //目标地址
		data: "dealType=" + dealType +"&uid=" + uid + "&code=" + code,
		error: function (XMLHttpRequest, textStatus, errorThrown) { },
		success: function (msg){ }
	});
}
//timer处理函数
function SetRemainTime() {
	if (curCount == 0) {                
		window.clearInterval(InterValObj);//停止计时器
		$("#btnSendCode").removeAttr("disabled");//启用按钮
		$("#btnSendCode").val("重新发送验证码");
		code = ""; //清除验证码。如果不清除，过时间后，输入收到的验证码依然有效    
	}
	else {
		curCount--;
		$("#btnSendCode").val( + curCount + "秒再获取");
	}
}
</script>

<script type="text/javascript">
$(document).ready(function() {
	$(".Select").each(function(){
		var s=$(this);
		var z=parseInt(s.css("z-index"));
		var dt=$(this).children("dt");
		var dd=$(this).children("dd");
		var _show=function(){dd.slideDown(200);dt.addClass("cur");s.css("z-index",z+1);};   //展开效果
		var _hide=function(){dd.slideUp(200);dt.removeClass("cur");s.css("z-index",z);};    //关闭效果
		dt.click(function(){dd.is(":hidden")?_show():_hide();});
		dd.find("a").click(function(){dt.html($(this).html());_hide();});     //选择效果（如需要传值，可自定义参数，在此处返回对应的“value”值 ）
		$("body").click(function(i){ !$(i.target).parents(".Select").first().is(s) ? _hide():"";});
	})
})
</script>

<script>
//获取上传按钮
var input1 = document.getElementById("upload"); 
 
if(typeof FileReader==='undefined'){ 
     //result.innerHTML = "抱歉，你的浏览器不支持 FileReader"; 
     input1.setAttribute('disabled','disabled'); 
}else{ 
     input1.addEventListener('change',readFile,false); 
     /*input1.addEventListener('change',function (e){
     	console.log(this.files);//上传的文件列表
     },false); */
}
function readFile(){ 
	var file = this.files[0];//获取上传文件列表中第一个文件
	if(!/image\/\w+/.test(file.type)){
	//图片文件的type值为image/png或image/jpg
		alert("文件必须为图片！");
		return false; 
	} 
	// console.log(file);
	var reader = new FileReader();//实例一个文件对象
	reader.readAsDataURL(file);//把上传的文件转换成url
	//当文件读取成功便可以调取上传的接口
	reader.onload = function(e){ 
		// console.log(this.result);//文件路径
		// console.log(e.target.result);//文件路径
		/*var data = e.target.result.split(',');
		var tp = (file.type == 'image/png')? 'png': 'jpg';
		var imgUrl = data[1];//图片的url，去掉(data:image/png;base64,)
		//需要上传到服务器的在这里可以进行ajax请求
		// console.log(imgUrl);
		// 创建一个 Image 对象 
		var image = new Image();
		// 创建一个 Image 对象 
		// image.src = imgUrl;
		image.src = e.target.result;
		image.onload = function(){
			document.body.appendChild(image);
		}*/

		var image = new Image();
		// 设置src属性 
		image.src = e.target.result;
		var max=200;
		// 绑定load事件处理器，加载完成后执行，避免同步问题
		image.onload = function(){ 
			// 获取 canvas DOM 对象 
			var canvas = document.getElementById("cvs"); 
			// 如果高度超标 宽度等比例缩放 *= 
			/*if(image.height > max) {
				image.width *= max / image.height; 
				image.height = max;
			} */
			// 获取 canvas的 2d 环境对象, 
			var ctx = canvas.getContext("2d"); 
			// canvas清屏 
			ctx.clearRect(0, 0, canvas.width, canvas.height); 
			// 重置canvas宽高
			/*canvas.width = image.width;
			canvas.height = image.height;
			if (canvas.width>max) {canvas.width = max;}*/
			// 将图像绘制到canvas上
			// ctx.drawImage(image, 0, 0, image.width, image.height);
			ctx.drawImage(image, 0, 0, 150, 150);
			// 注意，此时image没有加入到dom之中
		};  
	}
};
</script>

<script>
    $(document).ready(function(){
        <?php  if(!empty($info['province'])){?>
        var province = "<?= $info['province'] ?>";
        var city = "<?= $info['city'] ?>";
        var area = "<?= $info['towm'] ?>";
        <?php }else{ ?>
        var province = "省 必选";
        var city =  "市 必选";
        var area =  "区 必选";
        <?php } ?>
        var pcas = new PCAS("province,"+province,"city,"+city,"area,"+area);
    });
</script>

